#Knuth-Durstenfeld Shuffle
import random

#随机算法
def shuffle(lis):
    for i in range(len(lis) - 1, 0, -1):
        p = random.randrange(0, i + 1)
        print(p)
        lis[i], lis[p] = lis[p], lis[i]
    return lis
r = shuffle([1, 2, 2, 3, 3, 4, 5, 10])
print(r)